
def marching_partition(s):
    stack = []

    for i in range(len(s)):
        if s[i] in "([{":
            stack.append(s[i])
        elif s[i] in ")]}":
            if len(stack) == 0:
                return False
            else:
                top = stack.pop()
                if s[i] == '(' and top != ')':
                    return False
                elif s[i] == '[' and top!= ']':
                    return False
                elif s[i] == '{' and top!= '}':
                    return False
    return len(stack) == 0